package com.molichuxing.services.property;

/**
 * @Author: zhaopenghui
 * @Description:
 * @Date: Created in 11:27 2020/08/28
 * @Modified By:
 **/
public enum StatisticsAssetInStockTypeEnum {
    /**
     * 在库-实际在库
     */
    IN_STOCK_ACTUALLY_INSTOCK(41, "实际在库"),
    /**
     * 在库-在途车辆
     */
    IN_ROAD_VEHICLE(42, "在途车辆"),
    /**
     * 在库-诉讼中
     */
    IN_STOCK_IN_LAWSUIT(43, "诉讼中");

    int value;
    String name;

    StatisticsAssetInStockTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        StatisticsAssetInStockTypeEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static StatisticsAssetInStockTypeEnum getEnum(int value) {
        for (StatisticsAssetInStockTypeEnum enumerate : StatisticsAssetInStockTypeEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
}
